package com.neuralnoise.twitter;

import org.apache.commons.configuration.Configuration;
import org.apache.commons.configuration.ConfigurationException;
import org.apache.commons.configuration.PropertiesConfiguration;

public class TwitterProperties {

	private static final String DEFAULT_PROPERTIES_FILENAME = "twitter.properties";

	private String oAuthConsumerKey;
	private String oAuthConsumerSecret;
	private String oAuthAccessToken;
	private String oAuthAccessTokenSecret;
	
	private String startScreen;
	private Long startNode;
	
	private long millis;
	
	public TwitterProperties(String fileName) throws ConfigurationException {
		Configuration config = new PropertiesConfiguration(fileName);
		
		this.setoAuthConsumerKey(config.getString("twitter.oauth.consumerKey"));
		this.setoAuthConsumerSecret(config.getString("twitter.oauth.consumerSecret"));
		this.setoAuthAccessToken(config.getString("twitter.oauth.accessToken"));
		this.setoAuthAccessTokenSecret(config.getString("twitter.oauth.accessTokenSecret"));
		
		if (config.containsKey("twitter.startNode"))
			startNode = config.getLong("twitter.startNode");
		else
			startScreen = config.getString("twitter.startScreen");
		this.setMillis(config.getLong("twitter.millis"));
	}
	
	public TwitterProperties() throws ConfigurationException {
		this(DEFAULT_PROPERTIES_FILENAME);
	}
	
	public String getStartScreen() {
		return startScreen;
	}

	public void setStartScreen(String startScreen) {
		this.startScreen = startScreen;
	}
	
	public Long getStartNode() {
		return startNode;
	}

	public void setStartNode(Long startNode) {
		this.startNode = startNode;
	}
	
	public Long getMillis() {
		return millis;
	}

	public void setMillis(long l) {
		this.millis = l;
	}

	public String getoAuthConsumerKey() {
		return oAuthConsumerKey;
	}

	public void setoAuthConsumerKey(String oAuthConsumerKey) {
		this.oAuthConsumerKey = oAuthConsumerKey;
	}

	public String getoAuthConsumerSecret() {
		return oAuthConsumerSecret;
	}

	public void setoAuthConsumerSecret(String oAuthConsumerSecret) {
		this.oAuthConsumerSecret = oAuthConsumerSecret;
	}

	public String getoAuthAccessToken() {
		return oAuthAccessToken;
	}

	public void setoAuthAccessToken(String oAuthAccessToken) {
		this.oAuthAccessToken = oAuthAccessToken;
	}

	public String getoAuthAccessTokenSecret() {
		return oAuthAccessTokenSecret;
	}

	public void setoAuthAccessTokenSecret(String oAuthAccessTokenSectet) {
		this.oAuthAccessTokenSecret = oAuthAccessTokenSectet;
	}
}
